<?php

namespace App\Models\Api;

use Illuminate\Database\Eloquent\Model;

class GoodsCategory extends Model
{

    protected $table = 'goods_category';
    protected $primaryKey = 'id';
    protected $dateFormat = 'U';
    protected $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s'
    ];

    /**
     * 获取列表
     * @param array $where
     * @return mixed
     */
    public static function getAllList()
    {
        return self::select(['id', 'cate_name'])->get()->toArray();
    }

    public static function getNameById($id)
    {
        return self::where(['id' => $id])->value('cate_name');
    }
}
